
package com.hexinfo.dmpro.sparing.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hexinfo.dmpro.common.utils.CommonConstants;
import com.hexinfo.dmpro.sparing.model.SyncFullAudit;
import com.hexinfo.dmpro.sparing.model.SyncFullAuditDetail;
import com.hexinfo.dmpro.sparing.dao.SyncFullAuditDetailMapper;
import com.hexinfo.dmpro.sparing.model.SyncFullAuditTask;
import com.hexinfo.dmpro.sparing.service.SyncFullAuditDetailService;
import org.springframework.stereotype.Service;

/**
 * 全量稽核日志表（比对明细表）
 *
 * @author yemw
 * @date 2024-01-30 16:48:51
 */
@Service
public class SyncFullAuditDetailServiceImpl extends ServiceImpl<SyncFullAuditDetailMapper, SyncFullAuditDetail> implements SyncFullAuditDetailService {

    @Override
    public Page queryList(Page page, SyncFullAuditDetail syncFullAuditDetail) {
        LambdaQueryWrapper<SyncFullAuditDetail> wrapper = Wrappers.lambdaQuery();
        wrapper.like(StrUtil.isNotBlank(syncFullAuditDetail.getLibraryTableName()), SyncFullAuditDetail::getLibraryTableName,syncFullAuditDetail.getLibraryTableName())
                .eq(StrUtil.isNotBlank(syncFullAuditDetail.getTaskId()), SyncFullAuditDetail::getTaskId,syncFullAuditDetail.getTaskId())
                .eq(StrUtil.isNotBlank(syncFullAuditDetail.getTaskState()), SyncFullAuditDetail::getTaskState,syncFullAuditDetail.getTaskState())
                .eq(SyncFullAuditDetail::getDel,CommonConstants.STATUS_NORMAL).orderByDesc(SyncFullAuditDetail::getCreateTime);
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }
}
